
<!DOCTYPE html>
<html lang="zh" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>C++ 初学时旧笔记 - 二月の档案室</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="二月,"> 
    <meta name="description" content="所感所想，所言所行，我将以文字记录我自己。,1234567第一行代码#include &amp;lt;iostream &amp;gt;using namespace std;int main() &amp;#123;cout &amp;lt;&amp;lt; &amp;quot;Hell,"> 
    <meta name="author" content="Allureluoli"> 
    <link rel="alternative" href="atom.xml" title="二月の档案室" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
    
    
    <meta name="twitter:card" content="summary"/>
    <meta name="twitter:title" content="C++ 初学时旧笔记 - 二月の档案室"/>
    <meta name="twitter:description" content="所感所想，所言所行，我将以文字记录我自己。,1234567第一行代码#include &amp;lt;iostream &amp;gt;using namespace std;int main() &amp;#123;cout &amp;lt;&amp;lt; &amp;quot;Hell,"/>
    
    
    
    
    <meta property="og:site_name" content="二月の档案室"/>
    <meta property="og:type" content="object"/>
    <meta property="og:title" content="C++ 初学时旧笔记 - 二月の档案室"/>
    <meta property="og:description" content="所感所想，所言所行，我将以文字记录我自己。,1234567第一行代码#include &amp;lt;iostream &amp;gt;using namespace std;int main() &amp;#123;cout &amp;lt;&amp;lt; &amp;quot;Hell,"/>
    
<link rel="stylesheet" href="/css/diaspora.css">

    <script>window.searchDbPath = "/search.xml";</script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">
<meta name="generator" content="Hexo 6.3.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">二月の档案室</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="http://example.com"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">C++ 初学时旧笔记</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">C++ 初学时旧笔记</h1>
        <div class="stuff">
            <span>七月 23, 2022</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/%E5%9F%BA%E7%A1%80/" rel="tag">基础</a></li></ul>


        </div>
        <div class="content markdown">
            <figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">第一行代码</span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream &gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">cout &lt;&lt; <span class="string">&quot;Hello World!&quot;</span>;</span><br><span class="line"><span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125; </span><br></pre></td></tr></table></figure>



<h2 id="C-的集成环境-《Code-blocks》"><a href="#C-的集成环境-《Code-blocks》" class="headerlink" title="C++的集成环境  《Code blocks》"></a>C++的集成环境  《Code blocks》</h2><h3 id="codeblocks可以使用MINGW作为编译器-下载地址：https-sourceforge-net-projects-mingw-w64-MinGW内置了python-java-等-各种语言的编译器，以及调试器，只需要配置到codeblocks之中使用即可"><a href="#codeblocks可以使用MINGW作为编译器-下载地址：https-sourceforge-net-projects-mingw-w64-MinGW内置了python-java-等-各种语言的编译器，以及调试器，只需要配置到codeblocks之中使用即可" class="headerlink" title="codeblocks可以使用MINGW作为编译器  下载地址：https://sourceforge.net/projects/mingw-w64/   MinGW内置了python java 等..各种语言的编译器，以及调试器，只需要配置到codeblocks之中使用即可,"></a>codeblocks可以使用MINGW作为编译器  下载地址：<a target="_blank" rel="noopener" href="https://sourceforge.net/projects/mingw-w64/">https://sourceforge.net/projects/mingw-w64/</a>   MinGW内置了python java 等..各种语言的编译器，以及调试器，只需要配置到codeblocks之中使用即可,</h3><p>c++的难点：多维数组<br>7月24日<br> 例：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">string letters[<span class="number">2</span>][<span class="number">2</span>][<span class="number">2</span>] = &#123;</span><br><span class="line">&#123;</span><br><span class="line">&#123; <span class="string">&quot;A&quot;</span>, <span class="string">&quot;B&quot;</span> &#125;,</span><br><span class="line">&#123; <span class="string">&quot;C&quot;</span>, <span class="string">&quot;D&quot;</span> &#125;</span><br><span class="line">&#125;,</span><br><span class="line">&#123;</span><br><span class="line">&#123; <span class="string">&quot;E&quot;</span>, <span class="string">&quot;F&quot;</span> &#125;,</span><br><span class="line">&#123; <span class="string">&quot;G&quot;</span>, <span class="string">&quot;H&quot;</span> &#125;</span><br><span class="line">&#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<p>[]的数量代表着这个数组是几维<br> []内部代表着维度的数量，由大块向小块去看<br> 怎么叫做由大块向小块去看?<br> 此代码中，ABCD是一个大块，是第一维的<br> AB和CD又被分为二维的两个小块<br> A和B，又被第三维再分<br> 如此理解数组的概念<br> 此外，数组还有一条特殊的性质，叫做空间的连续性<br> 举例：[0][0][2]可以得到C 原因是，数组超出了原本的空间，但是由于空间是一条带状的连续的，可以访问到其他空间里面的元素。<br> 不仅如此，如果超出空间的部分是一片空白的内存，只要不超出太多也是可以访问的，因为系统给程序分配的内存往往比实际上大很多。<br> 而通过空间连续去修改内存也是病毒的特征之一。</p>
<h5 id="C-学习的第三天，7-25-关于面向对象（OOP）"><a href="#C-学习的第三天，7-25-关于面向对象（OOP）" class="headerlink" title="C++学习的第三天，7.25      关于面向对象（OOP）"></a>C++学习的第三天，7.25      关于面向对象（OOP）</h5><p>首先我们需要清楚类是什么            class MyClass {       &#x2F;&#x2F; The class     public:             &#x2F;&#x2F; Access specifier       int myNum;        &#x2F;&#x2F; Attribute (int variable)       string myString;  &#x2F;&#x2F; Attribute (string variable)    };          这是我们创建的一个类，类内部拥有自己的属性，以及访问说明符（public）     MyClass myObj;      而类可以以这种形式给对象使用，在这里myObj就是我们的对象，这个对象属于这个分类。     而分类后，对象可以使用自己分类的属性了，并且可以为自己的各项属性赋值。</p>
<h6 id="C-学习的第四天-7-26-对此前笔记的整理"><a href="#C-学习的第四天-7-26-对此前笔记的整理" class="headerlink" title="C++学习的第四天 7.26 对此前笔记的整理"></a>C++学习的第四天 7.26 对此前笔记的整理</h6><p>#include <iostream>  &#x2F;&#x2F;而这里，是C++头文件，头文件中包含了大量的信息，   using namespace std;  &#x2F;&#x2F; main() 是程序开始执行的地方   int main()  &#x2F;&#x2F;每个程序都从这里开始执行，这里是主程序，每个程序最主要的部分。  {     cout &lt;&lt; “Hello World”; &#x2F;&#x2F; 输出 Hello World     return 0;      &#x2F;&#x2F;返回一个0的值，在这里起到终止函数的作用                       &#x2F;&#x2F;花括号内，是运行的函数体，   }       如何去跑一段C++代码？   答案是，先编译，再运行！   我们在编写的文件为cpp文件，首先将cpp文件进行构建为exe文件，再进行运行。</p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="true">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title="0" data-url="https://webfs.ali.kugou.com/202307041713/4c5c9c66054ff1b1e920cbadbb47ec17/v2/c39d8792fe8a2cd84414ee5d2642f870/G199/M03/1B/10/p5QEAF4oPP-AUpsZACo25HetF6U984.mp3"></li>
                        
                    
                        
                            <li title="1" data-url="https://webfs.ali.kugou.com/202307041713/4c5c9c66054ff1b1e920cbadbb47ec17/v2/c39d8792fe8a2cd84414ee5d2642f870/G199/M03/1B/10/p5QEAF4oPP-AUpsZACo25HetF6U984.mp3"></li>
                        
                    
                </ul>
            
        </div>
        
        
    <div id="gitalk-container" class="comment link"
		data-enable="false"
        data-ae="false"
        data-ci=""
        data-cs=""
        data-r=""
        data-o=""
        data-a=""
        data-d="false"
    >查看评论</div>


    </div>
    
</div>


    </div>
</div>
</body>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/diaspora.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>






</html>
